package com.webwork.common.util;

/**
 * 结果返回
 *
 */
public final class RetUtil {

	protected static final String SUCCESS = "success";

	protected static final String FAIL = "fail";
	
	protected static final String EXIST = "exist";
	
	protected static final String NOT_EXIST = "noExist";
	
	/**
	 * 是否成功
	 */
	private Boolean isSuccess;
	
	/**
	 * 返回消息
	 */
	private String msg;

	public static RetUtil success() {
		RetUtil ret = new RetUtil();
		ret.setIsSuccess(true);
		ret.setMsg(SUCCESS);
		return ret;
	}
	
	public static RetUtil fail() {
		RetUtil ret = new RetUtil();
		ret.setIsSuccess(false);
		ret.setMsg(FAIL);
		return ret;
	}
	
	public RetUtil success(Boolean isSuccess) {
		this.setIsSuccess(isSuccess);
		return this;
	}
	
	public RetUtil message(String message) {
		this.setMsg(message);
		return this;
	}

	public Boolean getIsSuccess() {
		return isSuccess;
	}

	public void setIsSuccess(Boolean isSuccess) {
		this.isSuccess = isSuccess;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
	
}
